﻿CREATE TABLE [dbo].[Job] (
    [Id]           UNIQUEIDENTIFIER CONSTRAINT [DF_Job_Id] DEFAULT (newid()) NOT NULL,
    [JobTypeId]    UNIQUEIDENTIFIER NOT NULL,
    [CompanyId]    UNIQUEIDENTIFIER NOT NULL,
    [DateActive]   DATE             CONSTRAINT [DF_Job_DateActive] DEFAULT (getdate()) NOT NULL,
    [DateInactive] DATE             NULL,
    [Status]       TINYINT          CONSTRAINT [DF_Job_Status] DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_Job] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_Job_Company] FOREIGN KEY ([CompanyId]) REFERENCES [dbo].[Company] ([Id]),
    CONSTRAINT [FK_Job_JobType] FOREIGN KEY ([JobTypeId]) REFERENCES [dbo].[JobType] ([Id])
);

